﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Homework5._4
{
    class Program
    {
        static void Main(string[] args)
        {
            int n,i = 0;
            double MyAdd = 0;
            do
            {                
                n = 2 * i + 1;
                if (i%2==0)
                {
                    MyAdd = MyAdd + 1 / (double)n;
                }
                else
                {
                    MyAdd = MyAdd - 1 / (double)n;
                }
                i++;
            } while (1/(double)n>=0.000001);
            double PI = 4 * MyAdd;
            Console.WriteLine($"PI={PI}");
            Console.ReadKey();

        }
    }
}
